<?php
if ($_GET['pid'] < 1 || $_GET['pid'] == '') { header('Location: korting_list.php');}

require_once('lock.php');
require_once('access_adm.php');
require_once('../php/includes/constants.php');
require_once('../php/includes/db_access.php');
//require_once('../php/includes/random_password.php');
require_once('include_adm.php');


error_reporting(0);


$db = new Db(SERVER, USERNAME, PASSWORD);

$deId = $_GET['pid'];

if (isset($_POST['actType']) && ($_POST['actType'] == 'opslaan')) {
    
    $resultD = mysql_query("DELETE FROM cadeaubon WHERE cadeaubon_id=". $_POST['deId']);
    
    if($resultD){
    header('Location: korting_list.php');
    }
}

// MAIN //
$query = "SELECT * FROM cadeaubon WHERE cadeaubon_id =" . $_GET['pid'];
$result = mysql_query($query);
$num = mysql_numrows($result);
?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" href="styles/beheer.css" type="text/css" charset="utf-8" media="screen">
            <link rel="stylesheet" href="styles/jquery-ui-1.8.18.custom.css" type="text/css" charset="utf-8" media="screen">


                <META NAME="ROBOTS" CONTENT="NOARCHIVE, NOINDEX, NOFOLLOW" />
                <META NAME="GOOGLEBOT" CONTENT="NOSNIPPET" /> 
                <script type="text/javascript" src="js/jquery-1.4.3.min.js"></script>
                <script type="text/javascript" src="js/jquery-1.7.1.js"></script>
                <script type="text/javascript" src="js/jquery.curvycorners.packed.js"></script>
                <script type="text/javascript" src="js/radius.js"></script>
                <script type="text/javascript" src="js/fout.js"></script>
                <script type="text/javascript" src="js/foutbgone.js"></script>
                <script type="text/javascript" src="js/jquery.ui.core.js"></script>
                <script type="text/javascript" src="js/jquery.ui.widget.js"></script>
                <script type="text/javascript" src="js/jquery.ui.datepicker.js"></script>
                <SCRIPT type="text/javascript">
                    <!--

                    function checkForm(f) {
                        var re = new RegExp("^[0-9a-z]([-_.]?[0-9a-z_])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,}$",'i');

                        if (f.titel.value == "") {
                            alert( "Je hebt de naam van de schilder nog niet ingevuld!" );
                            document.getElementById("titel").style.backgroundColor="#708CA2";
                            f.titel.focus();
                            return false ;
                        }

                        return true;
                    }
                
                    ////jquery datepicker met aangepast datumformaat
  
                    $(function() {
                        $('input#datepicker,#datepicker1').datepicker({
                            dateFormat: 'yy-mm-dd',
                            changeMonth: false,
                            changeYear: false
                        },
                        $.datepicker.regional['nl']);
                    });

                    //-->
                </SCRIPT>






                <title>CMS | Hollandsche meesters</title>

                </head>

                <body>

                    <div id="wrapper">
                        <div id="container">
                            <?php include_once 'header.html'; ?>

                            <div id="content">
                                <div class="kop">
                                    <h1>CADEAUBON BEWERKEN <?php echo strtoupper($kunstwerk); ?></h1>
                                </div>
                                <div id="content-box">
                                    <div class="col-964">
                                        <div class="overzicht-box-gr">
                                            <h2 class="radiusTLTR">CADEAUBON</h2>
                                            <div class="box-964 radiusBLBR">

                                                <table width="800" border="0" cellspacing="5" cellpadding="5">
                                                    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="sform" id="sform" enctype="multipart/form-data" >
                                                        <input type="hidden" name="actType" value="opslaan" />
                                                        <input type="hidden" name="deId" value="<?php echo $deId; ?>">
                                                       
                                                        <tr>
                                                            <td width="100" valign="top"> &nbsp;&nbsp;&nbsp;</td>
                                                            <td width="300" valign="top"> &nbsp;&nbsp;&nbsp;</td>
                                                            <td width="200" valign="top"> &nbsp;&nbsp;&nbsp;</td>
                                                            <td width="200" valign="top"> &nbsp;&nbsp;&nbsp;</td>

                                                        </tr>


                                                        <tr>


                                                            <td  valign="top"> Naam:</td>
                                                            <td valign="top">

                                                             <?php echo mysql_result($result, 0, "naam"); ?>

                                                            </td>
                                                            <td valign="top" colspan="2">
                                                                (naam aktie of naam ontvanger)
                                                            </td>
                                                        </tr>

                                                        <tr>

                                                            <td colspan="4" height="30" valign="top"> &nbsp;&nbsp;&nbsp;</td>

                                                        </tr>

                                                        <tr>
                                                            <td  valign="top"> Dit is een:</td>
                                                            <td valign="top">
                                                               <?php if (mysql_result($result, 0, "type") == 'C'){
                                                                   
                                                                   echo 'Cadeaubon';
                                                                   
                                                               }else
                                                               {
                                                                   echo 'Aktie';
                                                               }
                                                               ?>
                                                       
                                
                                                            </td>
                                                            <td>
                                                                waarden &nbsp;&nbsp;<?php echo mysql_result($result, 0, "waarde"); ?> &euro;<br />
                                                                korting &nbsp; &nbsp; &nbsp;<?php echo mysql_result($result, 0, "korting"); ?> %
                                                            </td>
                                                            <td  valign="top"> (een malig gebruik!)</td>
                                                        </tr>
                                                        <tr>

                                                            <td colspan="4" height="30" valign="top"> &nbsp;&nbsp;&nbsp;</td>

                                                        </tr>

                                                        <tr>
                                                            <td valign="top"> code: </td>
                                                            <td valign="top">


                                                                <?php echo mysql_result($result, 0, "code"); ?>
                                                            </td>
                                                            <td valign="top"> &nbsp;&nbsp;&nbsp;</td>
                                                            <td valign="top"> &nbsp;&nbsp;&nbsp;</td>

                                                        </tr>

                                                        <tr>
                                                            <td valign="top"> Geldig van: </td>
                                                            <td valign="top">  
                                                                <?php echo mysql_result($result, 0, "geldig_van"); ?>
                                                            </td>
                                                            <td valign="top"> &nbsp;&nbsp;&nbsp;</td>
                                                            <td valign="top"> &nbsp;&nbsp;&nbsp;</td>

                                                        </tr>
                                                        <tr>
                                                            <td valign="top"> Geldig tot: </td>
                                                            <td valign="top">
                                                              <?php echo mysql_result($result, 0, "geldig_tot"); ?>
                                                            </td>
                                                            <td valign="top"> &nbsp;&nbsp;&nbsp;</td>
                                                            <td valign="top"> &nbsp;&nbsp;&nbsp;</td>

                                                        </tr>
                                                        <tr>

                                                            <td colspan="4" height="30" valign="top"> &nbsp;&nbsp;&nbsp;</td>

                                                        </tr>
                                                        <tr>
                                                            <td valign="top"> Aktief</td>
                                                            <td valign="top">
                                                               <?php if (mysql_result($result, 0, "aktief") == 'Y')
                                                                {
                                                                     echo 'Ja';
                                                               }else{ 
                                                                   echo 'Nee';
                                                                   
                                                                   }?>

                                                                </td>
                                                            <td valign="top"> &nbsp;&nbsp;&nbsp;</td>
                                                            <td valign="top"> &nbsp;&nbsp;&nbsp;</td>
                                                        </tr>

                                                        <tr>
                                                            <td>&nbsp;</td>
                                                            <td align="left">&nbsp;</td>
                                                            <td align="left"><input type="image" name="opslaan" src="images/btn-verwijderen.gif" width="90" height="25" class="btn" alt="VERWIJDEREN" title="VERWIJDEREN" /></td>

                                                            <td align="left">&nbsp;</td>
                                                        </tr>
                                                    </form>
                                                </table>
                                                </p>
                                            </div>
                                        </div>
                                    </div>		
                                </div>
                            </div>

                        </div>
                    </div>

                </body>
                </html>
